package com.sky.mapper;

import com.sky.entity.OrderDetail;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface OrderDetailMapper {

    /**
     * 批量插入
     * @param orderDetails
     */
    void insertBatch(List<OrderDetail> orderDetails);

    /**
     * 根据订单id查询明细
     * @param ordersId
     * @return
     */
    @Select("select * from sky_take_out.order_detail where order_id=#{ordersId}")
    List<OrderDetail> getByOrdersId(Long ordersId);

    /**
     * 根据订单id查询出每个订单的菜品
     * @param orderId
     * @return
     */
    @Select("select name from sky_take_out.order_detail where order_id=#{orderId}")
    List<String> searchDishNameByOrderId(Long orderId);
}
